const mysql = require('mysql2/promise');
const config = require('../config/database').mysql;

async function checkSellerSchema() {
  try {
    // 创建数据库连接
    const connection = await mysql.createConnection({
      host: config.host,
      user: config.user,
      password: config.password,
      database: config.database,
      port: config.port
    });
    
    console.log('开始检查卖家表结构...');
    
    // 查询bid_sellers表的结构
    const [sellerColumns] = await connection.query(
      "SHOW COLUMNS FROM bid_sellers"
    );
    
    console.log('\nbid_sellers表结构:');
    sellerColumns.forEach(col => {
      console.log(`${col.Field} (${col.Type}) - ${col.Key}`);
    });
    
    // 查询是否有卖家记录
    const [sellers] = await connection.query("SELECT id FROM bid_sellers LIMIT 5");
    console.log('\n现有的卖家记录ID:');
    sellers.forEach(seller => {
      console.log(seller.id);
    });
    
    // 关闭连接
    await connection.end();
    console.log('\n卖家表结构检查完成');
    
  } catch (error) {
    console.error('❌ 检查卖家表结构失败:', error.message);
  }
}

checkSellerSchema();